<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>静态文章更新 </title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="${base}/res/comm/js/jquery/jquery.js"></script>
<script language="JavaScript" type="text/javascript" src="${base}/res/comm/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="${base}/res/admin/js/admin.js"></script>
	<script lang="javascript">
		var pageno = 1;
		var allnum = 0;
		function save(){
			ajaxPost('${base}/admin/buildhtml/article.jhtml',{
				'cid':$('#cid').val(),
				'start':$('#start').val(),
				'end':$('#end').val(),
				'pageno':pageno,
				'pagesize':$('#pagesize').val()
				},null,'json',savecallback);
		}
		function savecallback(data){
			if(data.status=='articleBuilding'){
				pageno++;
				allnum += data.updateRows;
				save();
			}else if(data.status=='articleFinish'){
				allnum += parseInt(data.updateRows);
				window.alert('更新完成，共更新了'+allnum+'条记录！');
				pageno = 1;
				allnum = 0;
			}
		}
	</script>
</head>
<body class="input">
	<div class="body">
		<div class="inputBar">
			<h1><span class="icon">&nbsp;</span>文章静态更新</h1>
		</div>
		<table class="inputTable">
			<tr>
				<th>
					文章分类:
				</th>
				<td>
					<select id="cid" style="width:200px;">
						<option value="">更新所有分类</option>
						<#list articleCategoriesTreeList as list>
						<option value="${list.id}">---${list.name}</option>
						<#if list.children?size gt 0>
						<#list list.children as list>
						<option value="${list.id}">------${list.name}</option>
						</#list>
						</#if>
						</#list>
					</select>
				</td>
			</tr>	
			<tr class="dateTr">
				<th>
					起始日期:
				</th>
				<td>
					<input class="Wdate" type="text" id="start" value="${(start)!""}" onFocus="WdatePicker({readOnly:true})" title="留空则从最早的内容开始更新" style="width:200px;"/>
				</td>
			</tr>
			<tr class="dateTr">
				<th>
					结束日期:
				</th>
				<td>
					<input class="Wdate" type="text" id="end" value="${(end)!""}" onFocus="WdatePicker({readOnly:true})" title="留空则更新至最后的内容" style="width:200px;"/>
				</td>
			</tr>
			<tr>
				<th>
					每次更新数:
				</th>
				<td>
					<input type="text" id="pagesize" name="" class="formText" value="50"  style="width:200px;"/>
				</td>
			</tr>
			<tr>
		   		<td height="18" bgcolor="#FFFFFF" colspan=2 align="center">
		   			<input type="button" value="返回" onclick="window.history.back(-1)">
		   			<input type="button" value="一键静态更新"  onclick="save()"/>&nbsp;&nbsp;
		   		</td>
		   		<td width="10%"  bgcolor="#FFFFFF">&nbsp;</td>
		   	</tr>
		</table>
	</div>
</body>
</html>